import { initMixin } from './init'
import { stateMixin } from './state'
import { renderMixin } from './render'
import { eventsMixin } from './events'
import { lifecycleMixin } from './lifecycle'
import { warn } from '../util/index'
import type { GlobalAPI } from 'types/global-api'
// 定义Vue
function Vue(options) {
  if (__DEV__ && !(this instanceof Vue)) {
    warn('Vue is a constructor and should be called with the `new` keyword')
  }
  this._init(options)
}

//@ts-expect-error Vue has function type
initMixin(Vue) // 定义Vue的_init方法, new Vue时 调用的_init方法在其中 定义
//@ts-expect-error Vue has function type
stateMixin(Vue)// 静态属性 和静态方法 初始化 $data, $props, $set, $delete, $watch
//@ts-expect-error Vue has function type
eventsMixin(Vue)// $on，$once, $off, $emit, 事件相关方法的定义
//@ts-expect-error Vue has function type
lifecycleMixin(Vue)// 生命周期狗子 _update， $forceUpdate， $destroy
//@ts-expect-error Vue has function type
renderMixin(Vue) //添加 _render nextTick 方法 创建vnode 虚拟dom

export default Vue as unknown as GlobalAPI
